Automatic volume adjustment method and apparatus, medium, and device

ABSTRACT

The present disclosure relates to an automatic volume adjustment method and apparatus, a medium, and a device, which belong to the field of computer technologies, and can adjust the playback volume of audio or video. The automatic volume adjustment method includes: acquiring, in a case that a terminal does not output loudspeaker sound, a noise signal outside the terminal; determining noise energy based on the noise signal; and adjusting playback volume of audio or video on the terminal based on the noise energy.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of International ApplicationNo. PCT/CN2021/080304, filed on Mar. 11, 2021, which claims priority toChinese Patent Application No. 202010266544.8, titled “AUTOMATIC VOLUMEADJUSTMENT METHOD AND APPARATUS, MEDIUM, AND DEVICE”, filed on Apr. 7,2020. The disclosures of the above applications are hereby incorporatedby reference in their entireties.

TECHNICAL FIELD

The present disclosure relates to the field of computer technologiesand, in particular, to an automatic volume adjustment method andapparatus, a medium, and a device.

BACKGROUND

At present, when a user uses a handheld terminal (such as a mobilephone, a tablet computer, etc.) to play audio or video, the user usuallymanually sets playback volume that he/she considers comfortable. Whenthe environment changes, such as entering a noisy subway, the originalplayback volume is not loud enough for the user to hear the contentclearly due to the interference of environmental noise, and the userneeds to manually increase the playback volume again. If the environmentchanges frequently, the user needs to adjust the playback volumefrequently.

SUMMARY

The summary is provided to introduce concepts in a simplified form thatare described in detail in the description of embodiments that follows.The summary is not intended to identify key features or essentialfeatures of the claimed technical solution, nor is it intended to beused to limit the scope of the claimed technical solution.

In a first aspect, the present disclosure provides an automatic volumeadjustment method, including: acquiring, in a case that a terminal doesnot output loudspeaker sound, a noise signal outside the terminal;determining noise energy based on the noise signal; and adjustingplayback volume of audio or video on the terminal based on the noiseenergy.

In a second aspect, the present disclosure provides an automatic volumeadjustment apparatus, including: a noise signal acquiring module,configured to acquire, in a case that a terminal does not outputloudspeaker sound, a noise signal outside the terminal; a noise energydetermining module, configured to determine noise energy based on thenoise signal; and a volume adjusting module, configured to adjustplayback volume of audio or video based on the noise energy.

In a third aspect, the present disclosure provides a computer-readablemedium, on which a computer program is stored, where when the computerprogram is executed by a processing apparatus, the steps of the methodaccording to the first aspect of the present disclosure are implemented.

In a fourth aspect, the present disclosure provides an electronicdevice, including: a storage apparatus, on which a computer program isstored; and a processing apparatus, configured to execute a computerprogram stored in the storage apparatus to implement the steps of themethod according to the first aspect of the present disclosure.

In a fifth aspect, the present disclosure provides a computer programproduct, including a computer program carried on a computer-readablemedium, where the computer program, when executed by a processor,implements the steps of the method according to the first aspect of thepresent disclosure.

In a sixth aspect, the present disclosure provides a computer program,and when the computer program runs on an electronic device, theelectronic device is caused to implement the steps of the methodaccording to the first aspect of the present disclosure.

By adopting the above technical solution, since the noise signal outsidethe terminal can be acquired in a case that the terminal does not outputloudspeaker sound, then the noise energy can be determined based on thenoise signal, and then the playback volume of the audio or the video onthe terminal can be adjusted based on the noise energy, the automaticadjustment of the playback volume can thus be realized to avoid the usermanually adjusting the playback volume, and the interference of thesound played by the terminal per se to the noise of the terminal's theexternal environment per se can be eliminated in the process ofautomatically adjusting the playback volume, so that the automaticadjustment of the playback volume can be based only on the noise of theterminal's the external environment per se and thus be more accurate.

Other features and advantages of the present disclosure will bedescribed in detail in the description of embodiments that follows.

BRIEF DESCRIPTION OF DRAWINGS

The above and other features, advantages, and aspects of the embodimentsof the present disclosure will become more apparent in combination withthe accompanying drawings and with reference to the followingdescription of embodiments. Throughout the accompanying drawings,identical or similar reference numbers represent identical or similarelements. It should be understood that the accompanying drawings areillustrative, and components and elements are not necessarily drawn toscale. In the accompanying drawings:

FIG. 1 is an illustrative schematic diagram where a terminal does notoutput loudspeaker sound in a case that audio or video is played througha loudspeaker.

FIG. 2 is a flowchart of an automatic volume adjustment method accordingto an embodiment of the present disclosure.

FIG. 3 is a schematic block diagram of an automatic volume adjustmentapparatus according to an embodiment of the present disclosure.

FIG. 4 is a schematic structural diagram of an electronic deviceaccording to an embodiment of the present disclosure.

DESCRIPTION OF EMBODIMENTS

The embodiments of the present disclosure will be described in moredetail below with reference to the accompanying drawings. Although someembodiments of the present disclosure are shown in the accompanyingdrawings, it should be understood that the present disclosure may beimplemented in various forms and should not be construed as beinglimited to the embodiments set forth herein. On the contrary, theseembodiments are provided for a more thorough and complete understandingof the present disclosure. It should be understood that the accompanyingdrawings and embodiments of the present disclosure are merely forillustrative purposes, and are not intended to limit the protectionscope of the present disclosure.

It should be understood that the steps described in the methodimplementations of the present disclosure may be performed in differentorders, and/or performed in parallel. Furthermore, the methodimplementations may include additional steps and/or omit to perform theillustrated steps. The scope of the present disclosure is not limited inthis regard.

As used herein, the term “including” and variants thereof are open-endedinclusions, i.e., “including but not limited to”. The term “based on” is“at least partly based on”. The term “an embodiment” means “at least oneembodiment”; the term “another embodiment” means “at least one otherembodiment”; the term “some embodiments” means “at least someembodiments”. Relevant definitions of other terms will be given in thedescription below.

It should be noted that concepts such as “first” and “second” mentionedin the present disclosure are merely used to distinguish differentapparatuses, modules, or units, and are not used to limit the order orinterdependences of functions performed by these apparatuses, modules orunits.

It should be noted that the modifications of “one” and “a plurality of”mentioned in the present disclosure are illustrative rather thanrestrictive, and those skilled in the art should understand that theyshould be understood as “one or a plurality of” unless otherwiseexpressly stated in the context.

The names of messages or information exchanged between a plurality ofapparatuses in the implementations of the present disclosure are merelyfor illustrative purposes, and are not intended to limit the scope ofthese messages or information.

The inventors of the present disclosure found that when audio or videois played using a loudspeaker, the sound outside the terminal includesnot only the sound of the external environment of the terminal but alsothe sound of the audio or the video played by the terminal per se.

The inventors of the present disclosure also found that when users playaudio or video using a loudspeaker, they usually have actions such asturning a page, sliding up the screen, switching to a next piece ofaudio or video, pausing the playback of audio or video, and so on.During these actions, the terminal does not play any audio or video. Forexample, the duration of the action of turning a page is about severalseconds to more than ten seconds. During this time period, the terminaldoes not play any audio or video. In the present disclosure, those casesdescribed above are collectively referred to as a case that the terminaldoes not output loudspeaker sound, and the durations of the actionsdescribed above are collectively referred to as the interval of audio orvideo switching. FIG. 1 is an illustrative schematic diagram where aterminal does not output loudspeaker sound in a case that audio or videois played through a loudspeaker. The positions marked by the blocks inFIG. 1 correspond to the time periods when the terminal does not outputloudspeaker sound.

The inventors of the present disclosure also found that if a noisesignal outside a terminal can be collected during the time period thatthe terminal does not output loudspeaker sound in a case that audio orvideo is played through a loudspeaker, the interference of the soundplayed by the terminal per se to the noise signal of the terminal's theexternal environment per se can then be eliminated, and thus only thenoise signal of the terminal's the external environment per se iscollected, and then only the noise energy of the external environment ofthe terminal can be obtained.

FIG. 2 is a flowchart of an automatic volume adjustment method accordingto an embodiment of the present disclosure. As shown in FIG. 2 , theautomatic volume adjustment method may include the following steps S11to S13.

In step S11, in a case that a terminal does not output loudspeakersound, a noise signal outside the terminal is acquired.

The terminal may be a handheld terminal such as a mobile phone or atablet computer, or may be a terminal such as a smart TV, or may be asmart audio playing terminal such as a Xiaodu smart speaker.

In an implementation, whether the terminal is currently in a time periodthat the terminal does not output loudspeaker sound can be determinedthrough an application on the terminal returning a current playbackstate in real-time.

In an implementation, the noise signal outside the terminal may beacquired by using a built-in microphone of the terminal.

In step S12, noise energy is determined based on the noise signal.

In step S13, playback volume of audio or video on the terminal isadjusted based on the noise energy.

By adopting the above technical solution, since the noise signal outsidethe terminal can be acquired in a case that the terminal does not outputloudspeaker sound, then the noise energy can be determined based on thenoise signal, and then the playback volume of the audio or the video onthe terminal can be adjusted based on the noise energy, the automaticadjustment of the playback volume can thus be realized to avoid the usermanually adjusting the playback volume, and the interference of thesound played by the terminal per se to the noise of the terminal's theexternal environment per se can be eliminated in the process ofautomatically adjusting the playback volume, so that the automaticadjustment of the playback volume can be based only on the noise of theterminal's the external environment per se and thus be more accurate.

In an embodiment, the determination of the noise energy based on thenoise signal in step S12 may be implemented in multiple ways, and onlysome implementations thereof are given in the following.

A first implementation may include determining signal energy of a frameof signal last acquired in the noise signal as the noise energy, wherethe duration of each frame of signal may be set according to actualconditions, for example, may be set to 10 ms, 8 ms, 15 ms, etc., whichis not limited in the present disclosure. The calculation method of thesignal energy of the noise signal maybe to calculate by adopting anexisting calculation method of signal energy, which is not limited inthe present disclosure. By adopting this implementation, the currentnoise energy of the external environment of the terminal can bedetermined.

A second implementation can be described as follows.

Firstly, smoothing processing is performed on signal energy of previousN frames of signal in the noise signal to obtain smoothed energy of theprevious N frames of signal; the previous N frames of signal are Nframes of signal before the frame of signal last acquired in the noisesignal, and N is a positive integer greater than or equal to 1. Asmentioned above, the duration of each frame of signal may be setaccording to actual conditions, which is not limited in the presentdisclosure. The calculation method of the signal energy of each frame ofsignal may be to calculate by adopting an existing calculation method ofsignal energy, which is also not limited in the present disclosure.

Then, smoothing processing is performed on signal energy of the lastacquired frame of signal based on the smoothed energy of the previous Nframes of signal and the signal energy of the last acquired frame ofsignal, to obtain smoothed energy of the last acquired frame of signal.For example, the smoothing processing can be implemented using thefollowing formula:E_smoothed(t)=a1*E_smoothed(t−1)+a2*E_smoothed(t−2)+ . . .+aN*E_smoothed(t−N)+b1*E(t)

where, E_smoothed(t) represents the smoothed energy of the last acquiredframe of signal; E_smoothed(t−1), E_smoothed(t−2), . . . ,E_smoothed(t−N) represent the smoothed energy of the previous N framesof signal respectively; E(t) represents the signal energy of the lastacquired frame of signal; a1, a2, . . . , aN, b1 represent coefficients,and the sum of these coefficients is equal to 1; and t represents time.

An example is taken where N equal to 1, thenE_smoothed(t)=a1*E_smoothed(t−1)+b1*E(t), where the value of a1 may be0.70.95, for example, the value may be 0.9, and the value of b1 may be0.05˜0.3, for example, the value may be 0.1.

Finally, the smoothed energy of the last acquired frame of signal, i.e.,E_smoothed(t), is determined as the noise energy.

By adopting the above implementations, through performing smoothingprocessing on the signal energy of the last acquired frame of signalbased on the smoothed energy of the previous N frames of signal and thesignal energy of the last acquired frame of signal, the detected noiseenergy of the external environment of the terminal can be relativelysmooth, and then the adjustment of the playback volume is alsorelatively smooth, which avoids a substantial increase or decrease ofthe playback volume, thereby bringing a better user experience to auser.

A third implementation can be described as follows.

First, smoothing processing is performed on signal energy of previous Nframes of signal in the noise signal to obtain smoothed energy of theprevious N frames of signal; where the previous N frames of signal are Nframes of signal before the frame of signal last acquired in the noisesignal, and N is a positive integer greater than or equal to 1. Asmentioned above, the duration of each frame of signal may be setaccording to actual conditions, which is not limited in the presentdisclosure. The calculation method of the signal energy of each frame ofnoise signal may be to calculate by adopting an existing calculationmethod of signal energy, which is also not limited in the presentdisclosure.

Then, smoothing processing is performed on signal energy of the lastacquired frame of signal based on the smoothed energy of the previous Nframes of signal and the signal energy of the last acquired frame ofsignal to obtain smoothed energy of the last acquired frame of signal.

For example, the smoothing processing can be implemented using thefollowing formula:E_smoothed(t)=a1*E_smoothed(t−1)+a2*E_smoothed(t−2)+ . . .+aN*E_smoothed(t−N)+b1*E(t)

where, E_smoothed(t) represents the smoothed energy of the last acquiredframe of signal; E_smoothed(t−1), E_smoothed(t−2), E_smoothed(t−N)represent the smoothed energy of the previous N frames of signalrespectively; E(t) represents the signal energy of the last acquiredframe of signal; a1, a2, . . . , aN, b1 represent coefficients, and thesum of these coefficients is equal to 1; and t represents time.

An example is taken where N equal to 1, thenE_smoothed(t)=a1*E_smoothed(t−1)+b1*E(t), where the value of a1 may be0.7˜0.95, for example, the value may be 0.9, and the value of b1 may be0.05˜0.3, for example, the value may be 0.1.

Then, the smoothed energy of the last acquired frame of signal, i.e.,E_Smoothed(t), is compared with previously updated noise energyN_(previously updated noise energy).

In the case of performing processing on a first frame of the noisesignal, the smoothed energy E_smoothed(1) of the first frame of thenoise signal may be compared with the preset initial noise energyN_(preset initial noise energy). The preset initial noise energyN_(preset initial noise energy) is typically set to a value representinga relatively quiet environment. For example, the value of the presetinitial noise energy N_(preset initial noise energy) may be within therange of −120 dBFS˜170 dBFS, for example, may be set to be −96 dBFS.

Finally, the previously updated noise energy is updated based on thecomparison result to obtain updated noise energy.

In a case where the smoothed energy E_smoothed(t) of the frame of signallast acquired is less than the previously updated noise energyN_(previously updated noise energy), the previously updated noise energyN_(previously updated noise energy) is updated by using the followingformula:N _(updated noise energy)−(a*E_smoothed(t)+b*N_(previously updated noise energy))*c

In a case where the smoothed energy E_smoothed(t) of the frame of signallast acquired is greater than the previously updated noise energyN_(previously updated noise energy), the previously updated noise energyN_(previously updated noise energy) is updated by using the followingformula:N _(updated noise energy) −N _(previously updated noise energy) *d

where N_(updated noise energy) represents the updated noise energy,i.e., the current noise energy outside the terminal; a, b, c and d arecoefficients, and the sum of the coefficients a and b is equal to 1, andthe coefficients c and d may be within the range of 1˜1.1, for example,both c and d may be set to 1.0002; and t represents time.

By adopting the above implementation method, smooth automatic adjustmentof the playback volume can be realized to avoid sudden and largeincrease or decrease of the playback volume. For example, assuming thata user suddenly enters a very noisy environment from a very quietenvironment and starts TikTok to start watching a short video, in thiscase, the smoothed energy E_smoothed(t) of the frame of signal lastacquired is bound to be much greater than the preset initial noiseenergy N_(preset initial noise energy). At this time, sinceE_smoothed(t)>N_(preset initial noise energy), N preset initial noiseenergy is updated by using the above formulaN_(updated noise energy)=N_(previously updated noise energy)*d (in thecase of performing processing on the first frame of the noise signal,N_(previously updated noise energy) is N_(preset initial noise energy)),and then for the next frame, since E_smoothed(t) is still greater thanN_(previously updated noise energy), N previously updated noise energymay be updated through continuing to use the above formulaN_(updated noise energy)=N_(previously updated noise energy)*d accordingto the method of the present disclosure. Such repetition will graduallymake N_(updated) noise energy approximate E_smoothed(t). Furthermore,since the playback volume is adjusted based on the noise energyN_(updated noise energy) of the terminal's the external environment perse, the smooth automatic adjustment of the playback volume is realizedby the method according to the present disclosure.

In an embodiment, the adjustment of the playback volume of audio orvideo based on the noise energy described in step S13 may also beimplemented in multiple ways. An implementation may be to determinetarget volume corresponding to the noise energy by using a presetcorrespondence table, and then determine the playback volume of theaudio or the video based on the target volume. Another implementationmay be to calculate target volume corresponding to the noise energy byusing a preset functional relationship, where the target volume and thenoise energy satisfy the preset functional relationship, and thendetermine the playback volume of the audio or video based on the targetvolume. The preset correspondence table, the preset functionalrelationship, etc. may be obtained through experiments. For example, theplayback volume of browsing video or listening to audio by a user indifferent noise environments may be pre-collected, and then the playbackvolume and the ambient noise are taken as samples for training, or anaverage, a root mean square or the like may be taken for the playbackvolume in the same noise environment, so as to obtain a presetcorrespondence between the playback volume and the ambient noise. Whenadjusting the playback volume, the playback volume can be automaticallyadjusted based on these preset correspondences, so that the playbackvolume can be automatically increased in a noisy environment, and theplayback volume can be automatically reduced in a quiet environment, sothat the user can maintain a comfortable listening experience indifferent environments.

In an implementation, since the noise signal of the external environmentof the terminal is continuously collected during the time period thatthe terminal does not output loudspeaker sound, the adjustment of theplayback volume can also be continuously performed during the periodthat the terminal does not output loudspeaker sound. Of course, it isalso feasible to adjust the playback volume only at the end of the timeperiod that the terminal does not output loudspeaker sound, that is,when the time period that the terminal does not output loudspeaker soundlasts but has not ended, the noise energy outside the terminal iscontinuously determined by adopting the implementations described above,but the playback volume is not be adjusted, and then the playback volumeis adjusted based on the determined current ambient noise energy only atthe end of the time period, which can save the resource occupation ofthe terminal.

In an implementation, the automatic volume adjustment method accordingto the embodiments of the present disclosure may be executedcontinuously while a user is browsing videos or listening to audios. Forexample, if a user walks from a quiet home to a noisy street, and hasbeen watching a short video during the process, the automatic volumeadjustment method according to the embodiments of the present disclosureis also continuously executed during this time period. For anotherexample, if a user watches a short video through a terminal applicationat home, and then closes the terminal application, and then opens theterminal application again on a noisy street to watch a short video, theautomatic volume adjustment method according to the embodiments of thepresent disclosure is also continuously executed respectively when theuser opens the terminal application twice to watch short videos.

FIG. 3 is a schematic block diagram of an automatic volume adjustmentapparatus according to an embodiment of the present disclosure. As shownin FIG. 3 , the automatic volume adjustment apparatus includes: a noisesignal acquiring module 31, configured to acquire, in a case that aterminal does not output loudspeaker sound, a noise signal outside theterminal; a noise energy determining module 32, configured to determinenoise energy based on the noise signal; and a volume adjusting module33, configured to adjust playback volume of audio or video based on thenoise energy.

By adopting the above technical scheme, since the noise signal outsidethe terminal can be acquired in a case that the terminal does not outputloudspeaker sound, then the noise energy can be determined based on thenoise signal, and then the playback volume of the audio or the video onthe terminal can be adjusted based on the noise energy, the automaticadjustment of the playback volume can thus be realized to avoid a usermanually adjusting the playback volume, and the interference of thesound played by the terminal per se to the noise of the terminal's theexternal environment per se can be eliminated in the process ofautomatically adjusting the playback volume, so that the automaticadjustment of the playback volume can be based only on the noise of theterminal's the external environment per se and thus be more accurate.

Optionally, the noise energy determining module 32 is configured to:determine signal energy of a last acquired frame of signal in the noisesignal as the noise energy.

Optionally, the noise energy determining module 32 is configured to:perform smoothing processing on signal energy of previous N frames ofsignal in the noise signal to obtain smoothed energy of the previous Nframes of signal; where the previous N frames of signal are N frames ofsignal before the last acquired frame of signal in the noise signal, andN is a positive integer greater than or equal to 1; perform smoothingprocessing on signal energy of the last acquired frame of signal basedon the smoothed energy of the previous N frames of signal and the signalenergy of the last acquired frame of signal to obtain smoothed energy ofthe last acquired frame of signal; and determine the smoothed energy ofthe last acquired frame of signal as the noise energy.

Optionally, the noise energy determining module 32 is configured to:perform smoothing processing on signal energy of previous N frames ofsignal in the noise signal to obtain smoothed energy of the previous Nframes of signal; where the previous N frames of signal are N frames ofsignal before the last acquired frame of signal in the noise signal, andN is a positive integer greater than or equal to 1; perform smoothingprocessing on signal energy of the last acquired frame of signal basedon the smoothed energy of the previous N frames of signal and the signalenergy of the last acquired frame of signal to obtain smoothed energy ofthe last acquired frame of signal; compare the smoothed energy of thelast acquired frame of signal with previously updated noise energy; andupdate the previously updated noise energy based on a comparison resultto obtain updated noise energy.

Optionally, the noise energy determining module 32 is configured to:

-   -   in a case that the smoothed energy of the last acquired frame of        signal is less than the previously updated noise energy, update        the previously updated noise energy by the following formula:        N _(updated noise energy)−(a*E_smoothed(t)+b*N        _(previously updated noise energy))*c

in a case that the smoothed energy of the last acquired frame of signalis greater than the previously updated noise energy, update thepreviously updated noise energy by the following formula:N _(updated noise energy) −N _(previously updated noise energy) *d

where N_(updated noise energy) represents the updated noise energy;E_smoothed(t) represents the smoothed energy of the last acquired frameof signal; N_(previously updated noise energy) represents the previouslyupdated noise energy; a, b, c, and d are coefficients; and t representstime.

Optionally, the volume adjusting module 33 is configured to: determinetarget volume corresponding to the noise energy by using a presetcorrespondence table; and determine the playback volume of the audio orthe video based on the target volume.

Optionally, the volume adjusting module 33 is configured to: calculatetarget volume corresponding to the noise energy by using a presetfunctional relationship, where the target volume and the noise energysatisfy the preset functional relationship; and determine the playbackvolume of the audio or the video based on the target volume.

The specific implementations of the operations performed by respectivemodules in the automatic volume adjustment apparatus according to theembodiments of the present disclosure have been described in detail inthe related methods, which will not be repeated here.

Reference is made to FIG. 4 below, which shows a schematic structuraldiagram of an electronic device 600 suitable for implementing anembodiment of the present disclosure. The terminal device in theembodiment of the present disclosure may include, but is not limited to,a mobile terminal such as a mobile phone, a laptop, a digital broadcastreceiver, a PDA (personal digital assistant), a PAD (portable androiddevice), a PMP (portable media player), a vehicle-mounted terminal(e.g., a vehicle-mounted navigation terminal) or the like, and a fixedterminal such as a digital TV, a desktop computer or the like. Theelectronic device shown in FIG. 4 is merely an example, and should notimpose any restrictions on the function and the range of use of theembodiments of the present disclosure.

As shown in FIG. 4 , the electronic device 600 may include a processingapparatus (such as a central processor, a graphics processor and etc.)601, which may perform various appropriate actions and processingaccording to a program stored in a read only memory (ROM) 602 or aprogram loaded from a storage apparatus 608 to a random access memory(RAM) 603. In the RAM 603, various programs and data required for theoperation of the electronic device 600 are also stored. The processingapparatus 601, the ROM 602, and the RAM 603 are connected with eachother through a bus 604. An input/output (I/O) interface 605 is alsoconnected to the bus 604.

Generally, the following apparatuses may be connected to the I/Ointerface 605: an input apparatus 606, including, for example, a touchscreen, a touch panel, a keyboard, a mouse, a camera, a microphone, anaccelerometer, a gyroscope, and the like; an output apparatus 607,including, for example, a liquid crystal display (LCD), a speaker, avibrator, and the like; a storage apparatus 608, including, for example,a magnetic tape, a hard disk, and the like; and a communicationapparatus 609. The communication apparatus 609 may allow the electronicdevice 600 to perform wireless or wired communication with other devicesto exchange data. Although FIG. 4 shows the electronic device 600 withmultiple kinds of apparatuses, it should be understood that it is notrequired to implement or have all the apparatuses shown, andalternatively, it is possible to implement or provide more or fewerapparatuses.

In particular, according to embodiments of the present disclosure, theprocess described above with reference to the flowchart may beimplemented as a computer software program. For example, an embodimentof the present disclosure includes a computer program product, whichincludes a computer program carried on a non-transitory computerreadable medium. The computer program contains program code forexecuting the method shown in the flowcharts. In such an embodiment, thecomputer program may be downloaded from a network through thecommunication apparatus 609 and installed, or installed from the storageapparatus 608, or installed from the ROM 602. When the computer programis executed by the processing apparatus 601, the above-mentionedfunctions defined in methods of embodiments of the present disclosureare executed. The embodiments of the present disclosure also include acomputer program, when the computer program runs on the electronicdevice, the above-described functions defined in the methods of someembodiments of the present disclosure are performed.

It should be noted that, the above-mentioned computer readable medium inthe present disclosure may be a computer readable signal medium, or acomputer readable storage medium, or any combination of the both. Thecomputer readable storage medium may be, for example, but not limitedto, an electrical, magnetic, optical, electromagnetic, infrared, orsemiconductor system, apparatus or device, or any combination of theabove. A more specific example of the computer readable storage mediummay include, but is not limited to: an electrical connection with one ormore wires, a portable computer disk, a hard disk, a random accessmemory (RAM), a read only memory (ROM), an erasable programmable readonly memory (EPROM or a flash), an optical fiber, a portable compactdisc read only memory (CD-ROM), an optical storage device, a magneticstorage device, or any suitable combination of the above. In the presentdisclosure, the computer readable storage medium may be a tangiblemedium that contains or stores a program, and the program may be used byor in combination with an instruction execution system, apparatus, ordevice. In the present disclosure, a computer readable signal medium mayinclude a data signal propagated in a baseband or propagated as a partof a carrier wave, and computer readable program code is carriedtherein. This propagated data signal may adopt many forms, including butnot limited to, an electromagnetic signal, an optical signal, or anysuitable combination of the above. The computer readable signal mediummay also be any computer readable medium other than the computerreadable storage medium, and the computer readable signal medium maysend, propagate, or transmit the program used by or in combination withthe instruction execution system, apparatus, or device. The program codecontained on the computer readable medium may be transmitted by anysuitable medium, including but not limited to: a wire, an optical cable,RF (Radio Frequency), etc., or any suitable combination of the above.

In some implementations, a client and a server can communicate using anycurrently known network protocol such as HTTP (hypertext transferprotocol) or future developed network protocol, and can beinterconnected with digital data communication of any form or medium(e.g., a communication network). Examples of the communication networkinclude a local area network (“LAN”), a wide area network (“WAN”), aninter-network (e.g., the Internet), and a peer-to-peer network (e.g., anad hoc peer-to-peer network), as well as any currently known or futuredeveloped network.

The above-mentioned computer readable medium may be included in theabove-mentioned electronic device, or may exist alone without beingassembled into the electronic device.

The above-mentioned computer readable medium carries thereon one or moreprograms which, when executed by the electronic device, cause theelectronic device to: in a case that a terminal does not outputloudspeaker sound, acquire a noise signal outside the terminal;determine noise energy based on the noise signal; and adjust playbackvolume of audio or video on the terminal based on the noise energy.

Computer program code used to perform operations of the presentdisclosure may be written in one or more programming languages or acombination thereof. The above-mentioned programming languages include,but is not limited to, an object-oriented programming language, such asJava, Smalltalk, C++, and also include a conventional proceduralprogramming language, such as “C” language or similar programminglanguage. Program code may be executed entirely on a computer of a user,partly on a computer of a user, executed as an independent softwarepackage, partly executed on a computer of a user and partly executed ona remote computer, or entirely executed on a remote computer or aserver. In a case where a remote computer is involved, the remotecomputer may be connected to the computer of the user through any kindof network including a local area network (LAN) or a wide area network(WAN), or, may be connected to an external computer (for example,connected via the Internet utilizing an Internet service provider).

The flowcharts and block diagrams in the accompanying drawingsillustrate system architectures, functions, and operations of possibleimplementations of the system, method, and computer program product inaccordance with various embodiments of the present disclosure. In thispoint, each block in the flowcharts or block diagrams may represent amodule, a program segment, or a part of code, and the module, theprogram segment, or the part of code contains one or more executableinstructions for implementing a designated logical function. It shouldalso be noted that, in some alternative implementations, the functionsmarked in the blocks may also occur in a different order from the ordermarked in the drawings. For example, two blocks shown one after anothermay actually be executed substantially in parallel, or sometimes may beexecuted in a reverse order, which depends on the functions involved. Itshould also be noted that, each block in the block diagrams and/orflowcharts, and a combination of blocks in the block diagrams and/orflowcharts, may be implemented by a dedicated hardware-based system thatperforms designated functions or operations, or may be implemented by acombination of dedicated hardware and computer instructions.

The modules involved in the description of the embodiments of thepresent disclosure may be implemented in software or hardware, where aname of a module does not constitute a limitation on the module itselfin a certain case.

The functions described above herein may be performed at least in partby one or more hardware logic components. For example,non-restrictively, exemplary types of hardware logic components that maybe used include: a field programmable gate array (FPGA), an applicationspecific integrated circuit (ASIC), an application specific standardproduct (ASSP), a system on chip (SOC), a complex programmable logicdevice (CPLD), and the like.

According to one or a plurality of embodiments of the presentdisclosure, example 1 provides an automatic volume adjustment method,including: acquiring, in a case that a terminal does not outputloudspeaker sound, a noise signal outside the terminal; determiningnoise energy based on the noise signal; and adjusting playback volume ofaudio or video on the terminal based on the noise energy.

According to one or a plurality of embodiments of the presentdisclosure, example 2 provides the method of example 1, furtherincluding: determining signal energy of a last acquired frame of signalin the noise signal as the noise energy.

According to one or a plurality of embodiments of the presentdisclosure, example 3 provides the method of example 1, furtherincluding: performing smoothing processing on signal energy of previousN frames of signal in the noise signal to obtain smoothed energy of theprevious N frames of signal; where the previous N frames of signal are Nframes of signal before the last acquired frame of signal in the noisesignal, and N is a positive integer greater than or equal to 1;performing smoothing processing on signal energy of the last acquiredframe of signal based on the smoothed energy of the previous N frames ofsignal and the signal energy of the last acquired frame of signal toobtain smoothed energy of the last acquired frame of signal; anddetermining the smoothed energy of the last acquired frame of signal asthe noise energy.

According to one or a plurality of embodiments of the presentdisclosure, example 4 provides the method of example 1, furtherincluding: performing smoothing processing on signal energy of previousN frames of signal in the noise signal to obtain smoothed energy of theprevious N frames of signal; where the previous N frames of signal are Nframes of signal before the last acquired frame of signal in the noisesignal, and N is a positive integer greater than or equal to 1;performing smoothing processing on signal energy of the last acquiredframe of signal based on the smoothed energy of the previous N frames ofsignal and the signal energy of the last acquired frame of signal toobtain smoothed energy of the last acquired frame of signal; comparingthe smoothed energy of the last acquired frame of signal with previouslyupdated noise energy; and updating the previously updated noise energybased on a comparison result to obtain updated noise energy.

According to one or a plurality of embodiments of the presentdisclosure, example 5 provides the method of example 1, furtherincluding: in a case that the smoothed energy of the last acquired frameof signal is less than the previously updated noise energy, updating thepreviously updated noise energy by the following formula:N _(updated noise energy)−(a*E_smoothed(t)+b*N_(previously updated noise energy))*c

in a case that the smoothed energy of the last acquired frame of signalis greater than the previously updated noise energy, updating thepreviously updated noise energy by the following formula:N _(updated noise energy) −N _(previously updated noise energy) *d

where N_(updated noise energy) represents the updated noise energy;E_smoothed(t) represents the smoothed energy of the last acquired frameof signal; N_(previously updated noise energy) represents the previouslyupdated noise energy; a, b, c, and d are coefficients; and t representstime.

According to one or a plurality of embodiments of the presentdisclosure, example 6 provides the method of example 1, furtherincluding: determining target volume corresponding to the noise energyby using a preset correspondence table; and determining the playbackvolume of the audio or the video based on the target volume.

According to one or a plurality of embodiments of the presentdisclosure, example 7 provides the method of example 1, furtherincluding: calculating target volume corresponding to the noise energyby using a preset functional relationship, where the target volume andthe noise energy satisfy the preset functional relationship; anddetermining the playback volume of the audio or the video based on thetarget volume.

According to one or a plurality of embodiments of the presentdisclosure, example 8 provides the method of example 1, furtherincluding: acquiring the noise signal outside the terminal during aninterval of switching the audio or the video.

The above description is merely intended for preferred embodiments ofthe present disclosure and an illustration of the applied technicalprinciples. Those skilled in the art should understand that, thedisclosure scope involved in the present disclosure is not limited tothe technical solutions formed by a specific combination of the abovetechnical features, but also should cover other technical solutionsformed by an arbitrary combination of the above technical features ortheir equivalent features without departing from the above disclosureconcept, for example, a technical solution formed by a replacement ofthe above features with technical features with similar functionsdisclosed (but not limited to) in the present disclosure.

In addition, although respective operations are described in a specificorder, this should not be interpreted as requiring these operations tobe performed in the specific order shown or in a sequential order. Undercertain circumstances, multitasking and parallel processing may beadvantageous. Similarly, although several specific implementationdetails are included in the above discussion, these should not beinterpreted as limiting the scope of the present disclosure. Certainfeatures described in the context of a single embodiment may also beimplemented in combination in the single embodiment. Conversely, variousfeatures described in the context of a single embodiment may also beimplemented in multiple embodiments individually or in any suitablesub-combination.

Although the subject matter has been described in language specific tostructural features and/or method logical actions, it should beunderstood that the subject matter defined in the appended claims is notlimited to the specific features or actions described above. On thecontrary, the specific features and actions described above are onlyexample forms for implementing the claims. Regarding the apparatus inthe above-mentioned embodiments, the specific methods of performingoperations by respective modules have been described in detail in theembodiments related to the methods, which will not be described indetail here.

What is claimed is:
 1. An automatic volume adjustment method,comprising: in a case that a preset action by a user for audio or videobeing played on a terminal is detected, determining that the terminal isin an interval of audio or video switching currently, wherein theinterval of audio or video switching is a duration during which theterminal does not output loudspeaker sound; acquiring a noise signaloutside the terminal during the interval of audio or video switching;determining noise energy based on the noise signal; and adjustingplayback volume of audio or video on the terminal based on the noiseenergy; wherein the determining the noise energy based on the noisesignal comprises: performing smoothing processing on signal energy ofprevious N frames of signal in the noise signal to obtain smoothedenergy of the previous N frames of signal; wherein the previous N framesof signal are N frames of signal before a last acquired frame of signalin the noise signal, and N is a positive integer greater than or equalto 1; performing smoothing processing on signal energy of the lastacquired frame of signal based on the smoothed energy of the previous Nframes of signal and the signal energy of the last acquired frame ofsignal, to obtain smoothed energy of the last acquired frame of signal;determining the smoothed energy of the last acquired frame of signal asthe noise energy; or, comparing the smoothed energy of the last acquiredframe of signal with previously updated noise energy, and updating thepreviously updated noise energy based on a comparison result to obtainupdated noise energy.
 2. The method according to claim 1, wherein theupdating the previously updated noise energy based on the comparisonresult comprises: in a case that the smoothed energy of the lastacquired frame of signal is less than the previously updated noiseenergy, updating the previously updated noise energy by the followingformula:N _(updated noise energy)=(a*E_smoothed(t)+b*N_(previously updated noise energy))*c in a case that the smoothed energyof the last acquired frame of signal is greater than the previouslyupdated noise energy, updating the previously updated noise energy bythe following formula:N _(updated noise energy) =N _(previously updated noise energy) *dwherein N updated noise energy represents the updated noise energy;E_smoothed(t) represents the smoothed energy of the last acquired frameof signal; N_(previously updated noise energy) represents the previouslyupdated noise energy; a, b, c, and d are coefficients; and t representstime.
 3. The method according to claim 1, wherein the adjusting theplayback volume of the audio or the video on the terminal based on thenoise energy comprises: determining target volume corresponding to thenoise energy by using a preset correspondence table; and determining theplayback volume of the audio or the video based on the target volume. 4.The method according to claim 1, wherein the adjusting the playbackvolume of the audio or the video on the terminal based on the noiseenergy comprises: calculating target volume corresponding to the noiseenergy by using a preset functional relationship, wherein the targetvolume and the noise energy satisfy the preset functional relationship;and determining the playback volume of the audio or the video based onthe target volume.
 5. An automatic volume adjustment apparatus,comprising: at least one processor; and a memory; wherein the memorystores computer instructions; and the processor is configured to calland run the computer instructions stored in the memory to: in a casethat a preset action by a user for audio or video being played on aterminal is detected, determine that the terminal is in an interval ofaudio or video switching currently, wherein the interval of audio orvideo switching is a duration during which the terminal does not outputloudspeaker sound; acquire a noise signal outside the terminal duringthe interval of audio or video switching; determine noise energy basedon the noise signal; adjust playback volume of audio or video based onthe noise energy; perform smoothing processing on signal energy ofprevious N frames of signal in the noise signal to obtain smoothedenergy of the previous N frames of signal; wherein the previous N framesof signal are N frames of signal before a last acquired frame of signalin the noise signal, and N is a positive integer greater than or equalto 1; perform smoothing processing on signal energy of the last acquiredframe of signal based on the smoothed energy of the previous N frames ofsignal and the signal energy of the last acquired frame of signal, toobtain smoothed energy of the last acquired frame of signal; determinethe smoothed energy of the last acquired frame of signal as the noiseenergy; or, compare the smoothed energy of the last acquired frame ofsignal with previously updated noise energy, and update the previouslyupdated noise energy based on a comparison result to obtain updatednoise energy.
 6. The apparatus according to claim 5, wherein theprocessor is configured to call and run the computer instructions storedin the memory to: in a case that the smoothed energy of the lastacquired frame of signal is less than the previously updated noiseenergy, update the previously updated noise energy by the followingformula:N _(updated noise energy)=(a*E_smoothed(t)+b*N_(previously updated noise energy))*c in a case that the smoothed energyof the last acquired frame of signal is greater than the previouslyupdated noise energy, update the previously updated noise energy by thefollowing formula:N _(updated noise energy) =N _(previously updated noise energy) *dwherein N updated noise energy represents the updated noise energy;E_smoothed(t) represents the smoothed energy of the last acquired frameof signal; N_(previously updated noise energy) represents the previouslyupdated noise energy; a, b, c, and d are coefficients; and t representstime.
 7. The apparatus according to claim 5, wherein the processor isconfigured to call and run the computer instructions stored in thememory to: determine target volume corresponding to the noise energy byusing a preset correspondence table; and determine the playback volumeof the audio or the video based on the target volume.
 8. The apparatusaccording to claim 5, wherein the processor is configured to call andrun the computer instructions stored in the memory to: calculate targetvolume corresponding to the noise energy by using a preset functionalrelationship, wherein the target volume and the noise energy satisfy thepreset functional relationship; and determine the playback volume of theaudio or the video based on the target volume.
 9. A non-transitorycomputer-readable medium, on which a computer program is stored, whereinwhen the computer program is executed by a processor, the processor iscaused to: in a case that a preset action by a user for audio or videobeing played on a terminal is detected, determine that the terminal isin an interval of audio or video switching currently, wherein theinterval of audio or video switching is a duration during which theterminal does not output loudspeaker sound; acquire a noise signaloutside the terminal during the interval of audio or video switching;determine noise energy based on the noise signal; and adjust playbackvolume of audio or video based on the noise energy; perform smoothingprocessing on signal energy of previous N frames of signal in the noisesignal to obtain smoothed energy of the previous N frames of signal;wherein the previous N frames of signal are N frames of signal before alast acquired frame of signal in the noise signal, and N is a positiveinteger greater than or equal to 1; perform smoothing processing onsignal energy of the last acquired frame of signal based on the smoothedenergy of the previous N frames of signal and the signal energy of thelast acquired frame of signal, to obtain smoothed energy of the lastacquired frame of signal; determine the smoothed energy of the lastacquired frame of signal as the noise energy; or, compare the smoothedenergy of the last acquired frame of signal with previously updatednoise energy, and update the previously updated noise energy based on acomparison result to obtain updated noise energy.